<?php

class SportsEvent
{
	protected $_id;
	protected $_fullName;
	protected $_shortName;
	protected $_sport_id;
	protected $_description;
	
	public function __construct(array $donnees)
	{
		$this->hydrate($donnees);
	}
	
	public function hydrate(array $donnees)
	{
		foreach($donnees as $key => $value)
		{
			$method = 'set'. ucfirst($key);
			if(method_exists($this, $method))
			{
				$this->$method($value);
			}
		}
	}
	
	public function id(){ return $this->_id; }
	public function fullName(){ return $this->_fullName; }
	public function shortName(){ return $this->_shortName; }
	public function sport_id(){ return $this->_sport_id; }
	public function description(){ return $this->_description; }
	
	public function setId($id)
	{
		$id = (int) $id;
		if(is_int($id))
		{
			$this->_id = $id;
		}
	}
	public function setFullName($fullName)
	{
		$fullName = (string) $fullName;
		if(is_string($fullName))
		{
			$this->_fullName= $fullName;
		}
	}
	public function setShortName($shortName)
	{
		$shortName = (string) $shortName;
		if(is_string($shortName))
		{
			$this->_shortName= $shortName;
		}
	}
	public function setSport_id($sportId)
	{
		$sportId = (int) $sportId;
		if(is_int($sportId))
		{
			$this->_sport_id = $sportId;
		}
	}
	public function setDescription($description)
	{
		if(is_string($description))
		{
			$this->_description = $description;
		}
	}
	
}